package cn.bang.mod

import java.io.File

/**
 * 定义特定的文件和目录，方便使用
 */
data class Configuration(
    val basePath: String,
) {
    val originScriptDir: File = File(basePath sep "origin_script" sep "Assembly-CSharp")
    val outputDir: File = File(basePath sep "output")
    val excelDir: File = File(basePath sep "excel_files")

    val knowNameExcelDir: File = File(excelDir.absolutePath sep "know_name")

    val unknownScriptTranslDataExcelFile: File = File(excelDir.absolutePath sep "UnknownScriptTranslData.xlsx")
    val conversationExcelFile =  File(excelDir.absolutePath sep "Conversation.xlsx")
    val weeklyReportExcelFile =  File(excelDir.absolutePath sep "WeeklyReport.xlsx")
    val matchExcelFile =  File(excelDir.absolutePath sep "Match.xlsx")

    val ignoreTexts = File(basePath sep "ignore.txt").readText().lines().filter(String::isNotBlank).toSet()

    init {
        check(File(basePath).exists())
        // 需要自己反编译游戏代码，并放在指定[origin_script]目录！！
        check(originScriptDir.exists())
        check(outputDir.exists())
        check(excelDir.exists())
        check(knowNameExcelDir.exists())
        check(unknownScriptTranslDataExcelFile.exists())
        check(conversationExcelFile.exists())
        check(weeklyReportExcelFile.exists())
        check(matchExcelFile.exists())
    }

    /**
     * 用于寻找对应脚本文件的关键字
     */
    companion object SearchKey {
        const val CONVERSATION_SCRIPT_SEARCH_KEY = "I'm not a slave and you're not my master."
        const val WEEKLY_REPORT_SCRIPT_SEARCH_KEY = "The case will be heard in court after the funeral."
        const val MATCH_SCRIPT_SEARCH_KEY = "\"There is no way of winning this match.\";"
    }


}